home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / include / asm / sigcontext.h < prev    next >
C/C++ Source or Header  |  2009-10-16  |  5KB  |  215 lines

  1. #ifndef _ASM_X86_SIGCONTEXT_H
  2. #define _ASM_X86_SIGCONTEXT_H
  3.  
  4.  
  5. #include <linux/types.h>
  6.  
  7. #define FP_XSTATE_MAGIC1    0x46505853U
  8. #define FP_XSTATE_MAGIC2    0x46505845U
  9. #define FP_XSTATE_MAGIC2_SIZE    sizeof(FP_XSTATE_MAGIC2)
  10.  
  11. /*
  12.  * bytes 464..511 in the current 512byte layout of fxsave/fxrstor frame
  13.  * are reserved for SW usage. On cpu's supporting xsave/xrstor, these bytes
  14.  * are used to extended the fpstate pointer in the sigcontext, which now
  15.  * includes the extended state information along with fpstate information.
  16.  *
  17.  * Presence of FP_XSTATE_MAGIC1 at the beginning of this SW reserved
  18.  * area and FP_XSTATE_MAGIC2 at the end of memory layout
  19.  * (extended_size - FP_XSTATE_MAGIC2_SIZE) indicates the presence of the
  20.  * extended state information in the memory layout pointed by the fpstate
  21.  * pointer in sigcontext.
  22.  */
  23. struct _fpx_sw_bytes {
  24.     __u32 magic1;        /* FP_XSTATE_MAGIC1 */
  25.     __u32 extended_size;    /* total size of the layout referred by
  26.                  * fpstate pointer in the sigcontext.
  27.                  */
  28.     __u64 xstate_bv;
  29.                 /* feature bit mask (including fp/sse/extended
  30.                  * state) that is present in the memory
  31.                  * layout.
  32.                  */
  33.     __u32 xstate_size;    /* actual xsave state size, based on the
  34.                  * features saved in the layout.
  35.                  * 'extended_size' will be greater than
  36.                  * 'xstate_size'.
  37.                  */
  38.     __u32 padding[7];    /*  for future use. */
  39. };
  40.  
  41. #ifdef __i386__
  42. /*
  43.  * As documented in the iBCS2 standard..
  44.  *
  45.  * The first part of "struct _fpstate" is just the normal i387
  46.  * hardware setup, the extra "status" word is used to save the
  47.  * coprocessor status word before entering the handler.
  48.  *
  49.  * Pentium III FXSR, SSE support
  50.  *    Gareth Hughes <gareth@valinux.com>, May 2000
  51.  *
  52.  * The FPU state data structure has had to grow to accommodate the
  53.  * extended FPU state required by the Streaming SIMD Extensions.
  54.  * There is no documented standard to accomplish this at the moment.
  55.  */
  56. struct _fpreg {
  57.     unsigned short significand[4];
  58.     unsigned short exponent;
  59. };
  60.  
  61. struct _fpxreg {
  62.     unsigned short significand[4];
  63.     unsigned short exponent;
  64.     unsigned short padding[3];
  65. };
  66.  
  67. struct _xmmreg {
  68.     unsigned long element[4];
  69. };
  70.  
  71. struct _fpstate {
  72.     /* Regular FPU environment */
  73.     unsigned long    cw;
  74.     unsigned long    sw;
  75.     unsigned long    tag;
  76.     unsigned long    ipoff;
  77.     unsigned long    cssel;
  78.     unsigned long    dataoff;
  79.     unsigned long    datasel;
  80.     struct _fpreg    _st[8];
  81.     unsigned short    status;
  82.     unsigned short    magic;        /* 0xffff = regular FPU data only */
  83.  
  84.     /* FXSR FPU environment */
  85.     unsigned long    _fxsr_env[6];    /* FXSR FPU env is ignored */
  86.     unsigned long    mxcsr;
  87.     unsigned long    reserved;
  88.     struct _fpxreg    _fxsr_st[8];    /* FXSR FPU reg data is ignored */
  89.     struct _xmmreg    _xmm[8];
  90.     unsigned long    padding1[44];
  91.  
  92.     union {
  93.         unsigned long    padding2[12];
  94.         struct _fpx_sw_bytes sw_reserved; /* represents the extended
  95.                            * state info */
  96.     };
  97. };
  98.  
  99. #define X86_FXSR_MAGIC        0x0000
  100.  
  101. /*
  102.  * User-space might still rely on the old definition:
  103.  */
  104. struct sigcontext {
  105.     unsigned short gs, __gsh;
  106.     unsigned short fs, __fsh;
  107.     unsigned short es, __esh;
  108.     unsigned short ds, __dsh;
  109.     unsigned long edi;
  110.     unsigned long esi;
  111.     unsigned long ebp;
  112.     unsigned long esp;
  113.     unsigned long ebx;
  114.     unsigned long edx;
  115.     unsigned long ecx;
  116.     unsigned long eax;
  117.     unsigned long trapno;
  118.     unsigned long err;
  119.     unsigned long eip;
  120.     unsigned short cs, __csh;
  121.     unsigned long eflags;
  122.     unsigned long esp_at_signal;
  123.     unsigned short ss, __ssh;
  124.     struct _fpstate *fpstate;
  125.     unsigned long oldmask;
  126.     unsigned long cr2;
  127. };
  128.  
  129. #else /* __i386__ */
  130.  
  131. /* FXSAVE frame */
  132. /* Note: reserved1/2 may someday contain valuable data. Always save/restore
  133.    them when you change signal frames. */
  134. struct _fpstate {
  135.     __u16    cwd;
  136.     __u16    swd;
  137.     __u16    twd;        /* Note this is not the same as the
  138.                    32bit/x87/FSAVE twd */
  139.     __u16    fop;
  140.     __u64    rip;
  141.     __u64    rdp;
  142.     __u32    mxcsr;
  143.     __u32    mxcsr_mask;
  144.     __u32    st_space[32];    /* 8*16 bytes for each FP-reg */
  145.     __u32    xmm_space[64];    /* 16*16 bytes for each XMM-reg  */
  146.     __u32    reserved2[12];
  147.     union {
  148.         __u32    reserved3[12];
  149.         struct _fpx_sw_bytes sw_reserved; /* represents the extended
  150.                            * state information */
  151.     };
  152. };
  153.  
  154. /*
  155.  * User-space might still rely on the old definition:
  156.  */
  157. struct sigcontext {
  158.     unsigned long r8;
  159.     unsigned long r9;
  160.     unsigned long r10;
  161.     unsigned long r11;
  162.     unsigned long r12;
  163.     unsigned long r13;
  164.     unsigned long r14;
  165.     unsigned long r15;
  166.     unsigned long rdi;
  167.     unsigned long rsi;
  168.     unsigned long rbp;
  169.     unsigned long rbx;
  170.     unsigned long rdx;
  171.     unsigned long rax;
  172.     unsigned long rcx;
  173.     unsigned long rsp;
  174.     unsigned long rip;
  175.     unsigned long eflags;        /* RFLAGS */
  176.     unsigned short cs;
  177.     unsigned short gs;
  178.     unsigned short fs;
  179.     unsigned short __pad0;
  180.     unsigned long err;
  181.     unsigned long trapno;
  182.     unsigned long oldmask;
  183.     unsigned long cr2;
  184.     struct _fpstate *fpstate;    /* zero when no FPU context */
  185.     unsigned long reserved1[8];
  186. };
  187.  
  188. #endif /* !__i386__ */
  189.  
  190. struct _xsave_hdr {
  191.     __u64 xstate_bv;
  192.     __u64 reserved1[2];
  193.     __u64 reserved2[5];
  194. };
  195.  
  196. struct _ymmh_state {
  197.     /* 16 * 16 bytes for each YMMH-reg */
  198.     __u32 ymmh_space[64];
  199. };
  200.  
  201. /*
  202.  * Extended state pointed by the fpstate pointer in the sigcontext.
  203.  * In addition to the fpstate, information encoded in the xstate_hdr
  204.  * indicates the presence of other extended state information
  205.  * supported by the processor and OS.
  206.  */
  207. struct _xstate {
  208.     struct _fpstate fpstate;
  209.     struct _xsave_hdr xstate_hdr;
  210.     struct _ymmh_state ymmh;
  211.     /* new processor state extensions go here */
  212. };
  213.  
  214. #endif /* _ASM_X86_SIGCONTEXT_H */
  215.